Theory of machines GATE example problem 9